package com.data.capture.config;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Spring Bean 常量注入
 * @author linch
 **/
@Component
public class BeanConstant {

    /**
     * RocketMQ 模板
     */
    private static RocketMQTemplate ROCKET_MQ_TEMPLATE;

    @Autowired
    public void setRocketMqTemplate(RocketMQTemplate rocketMqTemplate) {
        ROCKET_MQ_TEMPLATE = rocketMqTemplate;
    }

    public static RocketMQTemplate mqTemplate() {
        if (ROCKET_MQ_TEMPLATE == null) {
            throw new RuntimeException("RocketMQTemplate is null");
        }
        return ROCKET_MQ_TEMPLATE;
    }

}
